<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>组件的模板分离式写法——使用 script</title>
</head>
<body>
<div id="app">
    <cpn></cpn>
</div>

<script type="text/x-template" id="cpn">
    <h1>这是组件的代码模板</h1>
    <h1>世界，你好！</h1>
</script>


<script type="module">
    import {createApp, defineComponent} from "../../../../js/vue.esm-browser.js";

    let component = defineComponent({
        // 通过 组件 id 来指定 HTML 代码
        template: "#cpn",
    });



    let app = createApp({
        setup() {
            return {}
        }
    })

    app.component("cpn", component)

    app.mount("#app")
</script>
</body>
</html>